import time
from concurrent.futures import ThreadPoolExecutor, as_completed

executor = ThreadPoolExecutor(5)

def longtime(s):
    time.sleep(s)
    return f'执行结果：{s + 10}'

all_task = []
for i in range(10):
    # 提交任务
    e = executor.submit(longtime, i)
    # 添加到list
    all_task.append(e)
    print(i)
    
for future in as_completed(all_task):
    # 获得线程池中任务执行的结果
    result = future.result()
    print(result)